﻿using Newtonsoft.Json;
using System.Collections.Generic;

namespace AutomationCommand
{
    public class wb_data_api : BasiCommand
    {
        [JsonProperty("tablename")]
        public string TableName { get; set; }

        [JsonProperty("sourcetype")]
        public string SourceType { get; set; }

        [JsonProperty("api")]
        public string Api { get; set; }

        [JsonProperty("send")]
        public List<SendData> Send { get; set; }

        [JsonProperty("secretkey")]
        public string SecretKey { get; set; }

        [JsonProperty("datarout")]
        public List<DataRoute> DataRoute { get; set; }

        public wb_data_api()
        {
            FunctionType = "wb_data_api";
            OtherName = "数据接口";
            TableName = "";
            SourceType = "cachkey";
            Api = "";
            Send = new List<SendData>();
            SecretKey = "";
            DataRoute = new List<DataRoute>();
            SuccessJump = -1;
            FailureJump = -1;
        }

        public  bool Execute()
        {
            // 在这里编写执行命令的逻辑
            // 返回执行结果
            return true; // 假设此处始终成功
        }
    }

    public class SendData
    {
        [JsonProperty("keyname")]
        public string KeyName { get; set; }

        [JsonProperty("relational")]
        public string Relational { get; set; }

        [JsonProperty("value")]
        public string Value { get; set; }
    }

    public class DataRoute
    {
        [JsonProperty("keyname")]
        public string KeyName { get; set; }
    }
}
